package com.mlf.factory.easyFactory.demo;

// 3. 工厂类
public class ShapeEasyFactory {
    // 工厂方法
    public Shape createShape(String type) {
        if ("CIRCLE".equalsIgnoreCase(type)) {
            return new Circle();
        } else if ("RECTANGLE".equalsIgnoreCase(type)) {
            return new Rectangle();
        }
        throw new IllegalArgumentException("Invalid shape type");
    }
}